SRC=./src
COMPILE_ONLY =c
CFLAGS= -ansi  -pedantic -Wall
BIN=bin
OBJ=obj
CM=Common
PB=Public
ST=Static
DN=Dinamic

CC=gcc

Debug:   Debug_OR_Release=Debug
Debug:   CFLAGS+=-g 
Debug:   SUBDIRS= ./$(OBJ)/$(Debug_OR_Release) ./$(BIN)/$(Debug_OR_Release)
Debug:   OBJ_F=$(OBJ)/$(Debug_OR_Release)/vector_inside.o

Release: Debug_OR_Release=Release
Release: CFLAGS+=-DNDEBUG -O2
Release: SUBDIRS= ./$(OBJ)/$(Debug_OR_Release) ./$(BIN)/$(Debug_OR_Release)
Release: OBJ_F=$(OBJ)/$(Debug_OR_Release)/vector_inside.o



all: Release

Debug:   create_folders  libvector.a  Install Clear 
Release: create_folders  libvector.a  Install Clear



libvector.a:listing_act_vecinside vector.o
	ar -rs -o ./$(BIN)/$(Debug_OR_Release)/libvector_inside.a  $(OBJ_F)

listing_act_vecinside:
	@echo
	@echo "-----------------------------------"
	@echo "   PRODUCING VectorInside Library "
	@echo "-----------------------------------"
	@echo 


vector.o: $(SRC)/Vector_inside.c $(SRC)/Vector_inside.h
	$(CC)  $(CFLAGS) -I $(SRC) -$(COMPILE_ONLY) $(SRC)/Vector_inside.c  -o $(OBJ_F)

create_folders:
	-mkdir $(OBJ)
	-mkdir $(BIN)
	-mkdir $(OBJ)/$(Debug_OR_Release) 
	-mkdir $(BIN)/$(Debug_OR_Release)

Install:creat_instal_folders CopyF CopyHfile 


CopyF: 
	cp ./$(BIN)/$(Debug_OR_Release)/libvector_inside.a  ../$(CM)/$(BIN)/$(Debug_OR_Release)

CopyHfile:
	cp $(SRC)/Vector_inside.h ../Common/$(PB)
		
creat_instal_folders:
	- mkdir ../$(CM)
	- mkdir ../$(CM)/$(BIN)
	- mkdir ../$(CM)/$(PB)
	- mkdir ../$(CM)/$(BIN)/$(Debug_OR_Release)


Clear:
	for i in $(SUBDIRS); do\
		(cd $$i; rm * );\
	done


	


